package com.zc.im.common.constant;

import com.sun.istack.internal.NotNull;

/**
 * Project：im
 * Date：2022/4/20
 * Time：14:20
 * Description：内网ip常量
 *
 * @author Challen.Zhang
 * @version 1.0
 */
public class IpConst {

    /**
     * 内网网段
     */
    public static final String LOCALHOST = "127.0.0.1";

    /**
     * 内网网段
     */
    public static final String INTRANET = "192.168";

    /**
     * docker网段
     */
    public static final String DOCKER = "172.17";


    /**
     * 内网网段匹配
     *
     * @param ip ip
     * @return 结果
     */
    public static boolean contains(@NotNull String ip) {
        return ip.startsWith(IpConst.LOCALHOST) || ip.startsWith(IpConst.DOCKER) || ip.startsWith(IpConst.INTRANET);
    }

}
